/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import { Request, Response } from 'express';
import { ResponseItem, responseSuccess } from './utils';
import type { yzBond, address } from '@/pages/Financial/YzBond/index.d';
// import type { HTTableListItem } from '@/pages/Financial/index.d';

import Mock, { mock } from 'mockjs';

export default {
  'POST /Inn/getBondLogList': (req: Request, res: Response, u: string) => {
    let data: yzBond[] = Mock.mock({
      'list|1-10': [
        {
          'id|1-1000': 1000,
          cm_id: '1614735',
          inn_name: '通协小区便利店',
          phone: '15818732277',
          trans_amount: '100.00',
          balance: '200.00',
          created_at: '2021-12-25 10:21:00',
          action_type: '退保证金',
          action_status: '审核中',
          action_status_code: '2',
          yz_address: '上海市上海市长宁区北新泾街道',
        },
      ],
    });
    const result: ResponseItem = {
      code: 0,
      msg: '成功',
      data: req.body.export
        ? 'http://upload.kuaidihelp.com/admin/bond/csv/2021/12/保证金管理数据导出_20211229154844.csv'
        : data,
    };
    return res.json(result);
  },

  'POST /Inn/approveBondBackApply': (req: Request, res: Response) => {
    return res.json({
      code: 0,
      msg: '成功',
      data: {},
    });
  },
  'POST /Inn/bondAreaAdd': (req: Request, res: Response) => responseSuccess(req, res),
  'POST /Inn/bondAreaDelete': (req: Request, res: Response) => responseSuccess(req, res),
  'POST /Inn/getBondAreaList': (req: Request, res: Response, u: string) => {
    res.send(
      mock({
        code: 0,
        msg: '成功',
        data: {
          total: 100,
          list: [
            {
              id: '1',
              addressName: '浙江省杭州市(拱墅区、西湖区)',
              address: ['1', '2'],
              district: ['6'],
            },
          ],
        },
      }),
    );
  },
};
